﻿package character {
	import flash.display.MovieClip;
	import flash.events.*;
	public class AttackMove extends MovieClip{
		
		protected var subject:Character;
		public var nFrame:int;
		public var frameIndex:int;
		//public var nFrame:int;
		//public var range:int;
		public var startFrame:int;
		public var damage:Number;
		public var t:int;
		/*public function AttackMove() {
			// constructor code
		}*/
		
		public function AttackMove(i:int,f:int,s:Character) {
			// constructor code
			frameIndex = i;
			nFrame = f;
			subject = s;

			addEventListener(Event.ENTER_FRAME,onFrameLoop);
		}
		
		protected function onFrameLoop(evt:Event):void {
			Update();
		}
		
		public function Start()
		{
			scaleX=subject.scaleX;
			scaleY=subject.scaleY;
			x = subject.x;
			y = subject.y;
			//gotoAndPlay(1);
		}
		
		public function Update()
		{	
			/*x=subject.x;
			y=subject.y;
			if(currentFrame == this.totalFrames)
			{
				
				stop();
			}*/
			
			x=subject.x;
			y=subject.y;
			if(currentFrame == this.totalFrames)
			{
				RemoveUpdateEvent();
				stop();
			}
		}
		
		public function RemoveUpdateEvent()
		{
			removeEventListener(Event.ENTER_FRAME,onFrameLoop);
		}
	}
	
}
